/*
 * aqua-firefox-theme
 * csd.css
 *
 * Copyright (c) 2019 Payson Wallach
 *
 * Released under the terms of the GNU General Public License, version 3
 * (https://gnu.org/licenses/gpl.html)
 */

@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

#main-window {
  -moz-appearance: -moz-window-titlebar !important;
}

/* headerbar top border corners rounded */
:root[tabsintitlebar]:not([inFullscreen]):not([sizemode="maximized"]) #nav-bar {
  border-radius: 7px 7px 0 0 !important;
}

/* fullscreen headerbar padding for one button */
:root[tabsintitlebar][inFullscreen] #nav-bar {
  padding-right: 50px !important;
}

/* window buttons box */
:root[tabsintitlebar] #titlebar .titlebar-buttonbox-container,
:root[tabsintitlebar] #titlebar-buttonbox-container,
:root[tabsintitlebar][inFullscreen] #window-controls {
  -moz-appearance: none !important;
  position: absolute !important;
  top: -5px;
  left: 0;
  padding: 0 6px;
}

/* FF 71+ */
:root[tabsintitlebar] #titlebar .titlebar-buttonbox-container {
  display: block;
}

/* remove close and minimize buttons from fullscreen buttons */
:root[tabsintitlebar][inFullscreen] #window-controls #close-button,
:root[tabsintitlebar][inFullscreen] #window-controls #minimize-button {
  display: none;
}

/* left window buttons */
:root[tabsintitlebar]:not([inFullscreen]) #nav-bar {
  padding-left: 80px !important;
}

/* reorder window buttons */

.titlebar-button:nth-child(2) {
  -moz-box-ordinal-group: 2 !important;
}

.titlebar-button:last-of-type {
  margin-right: 6px !important;
  -moz-box-ordinal-group: 0 !important;
}

/* remove tabs-bar titlebar blank spaces */
:root[tabsintitlebar] #TabsToolbar .titlebar-placeholder {
  display: none !important;
}

/* prevent menubar from breaking */
:root[tabsintitlebar] #toolbar-menubar:not([inactive=true]) {
  height: 30px !important;
  margin-bottom: 8px;
}

/* remove default style of titlebar */
:root[tabsintitlebar] #titlebar {
  -moz-appearance: none !important;
}

/* fix the issue when dragging tabs */
:root[tabsintitlebar] #navigator-toolbox[movingtab] #TabsToolbar {
  padding-bottom: 0 !important;
}

/* allow window drag with headerbar buttons */

:root[tabsintitlebar] #nav-bar *,
:root[tabsintitlebar] #titlebar .titlebar-button,
:root[tabsintitlebar][inFullscreen] #window-controls toolbarbutton {
  -moz-window-dragging: drag;
}

:root[tabsintitlebar] #nav-bar .urlbar-input-box,
:root[tabsintitlebar] #nav-bar .urlbar-input-box *,
#back-button,
#forward-button {
  -moz-window-dragging: no-drag !important;
}

/* Firefox 60 fixes */

:root[tabsintitlebar] #titlebar[style="margin-bottom: -1px;"] {
  margin-bottom: -28px !important;
}

:root[tabsintitlebar] #titlebar-content {
  display: block !important;
  position: absolute;
  height: 28px !important;
  top: 0 !important;
}

:root[tabsintitlebar] #titlebar-buttonbox {
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
}

:root[tabsintitlebar] #titlebar-content .titlebar-button {
  padding: 0 7px !important;
}
